package com.itheima.reggie.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.itheima.reggie.bean.Category;
import com.itheima.reggie.common.R;
import com.itheima.reggie.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/category")
@RestController
public class CategoryController {
    @Autowired
    protected CategoryService cs;

    @GetMapping("/list")
    public R findList(){
        try {
            List<Category> page =  cs.findList();

            return R.success(page);
        } catch (Exception e) {
            e.printStackTrace();
            return R.error("查询失败！");
        }


    }




}
